package com.ksyun.campus.client.service.impl;

import com.ksyun.campus.client.FSInputStream;
import com.ksyun.campus.client.FSOutputStream;
import com.ksyun.campus.client.domain.ClusterInfo;
import com.ksyun.campus.client.domain.StatInfo;
import com.ksyun.campus.client.service.EFileService;
import com.ksyun.campus.client.util.ZkUtil;
import org.apache.curator.framework.CuratorFramework;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class EFileServiceImpl implements EFileService {


    @Override
    public ClusterInfo getClusterInfo() {

        ClusterInfo cluster=ZkUtil.getCluster();

        return cluster;
    }

    @Override
    public FSInputStream open(String fileName,String path) {
        FSInputStream fsInputStream=ZkUtil.open(fileName,path);
        return fsInputStream;
    }

    @Override
    public FSOutputStream create(String fileName,String path) {
        FSOutputStream fsOutputStream=ZkUtil.create(fileName,path);
        return fsOutputStream;
    }

    @Override
    public boolean mkdir(String fileName,String path) {
        boolean b = ZkUtil.mkdir(fileName,path);
        return b;
    }

    @Override
    public boolean delete(String fileName,String path) {
        ZkUtil.delete(fileName,path);
        return false;
    }

    @Override
    public StatInfo getFileStats(String fileName,String path) {
        return ZkUtil.getFileStats(fileName,path);

    }

    @Override
    public List<StatInfo> listFileStats(String fileName,String path) {
        return ZkUtil.getListFileStats(fileName,path);
    }
}
